﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Contents;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Contents
{
    #region  NewsLanguage
    
    public class NewsLanguageBUSS
    {
        private const string NEWSLANGUAGE_ALL_KEY = "Mp.newslanguage.all-{0}";
        private const string NEWSLANGUAGE_BY_ID_KEY = "Mp.newslanguage.id-{0}";
        
        private static void NewsLanguageRemoveCache()
        {
             MpCache.RemoveByPattern(NEWSLANGUAGE_ALL_KEY);
             MpCache.RemoveByPattern(NEWSLANGUAGE_BY_ID_KEY);
        }
        
        public static int NewsLanguage_Add(NewsLanguage obj)
        {
            var result = NewsLanguageDAO.NewsLanguage_Add(obj);
            return result;
        }
        public static int NewsLanguage_Update(NewsLanguage obj)
        {
            var result = NewsLanguageDAO.NewsLanguage_Update(obj);
            return result;
        }

        public static int NewsLanguage_Delete(int NLID)
        {
            var result = NewsLanguageDAO.NewsLanguage_Delete(NLID);
            return result;
        }

        public static NewsLanguage NewsLanguage_ByID(int NewsID, string LanguageCode)
        {
            var list = NewsLanguage_Select(-1, NewsID, LanguageCode);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<NewsLanguage> NewsLanguage_Select(int NLID, int NewsID, string LanguageCode)
        {
            return NewsLanguageDAO.NewsLanguage_Select(NLID, NewsID, LanguageCode);
        }

    }
    
    #endregion
}

